<?php

namespace app\validate;

use think\Validate;

/**
 * 需求统计验证
 */
class EntityStatisticsValidate extends Validate
{
    /**
     * GetEntityAppendDemand
     * @return EntityStatisticsValidate
     */
    public function sceneGetEntityAppendDemand(): EntityStatisticsValidate
    {
        return $this->append('param', 'require|array')
            ->append('param.project_ids', 'require|array')
            ->append('param.range_time', 'require|array')
            ->append('param.standard_append', 'in:yes,no')
            ->append('param.module_code', 'in:asset,shot')
            ->append('param.stage_id', 'integer')
            ->append('param.page', 'array')
            ->append('param.response_format_type', 'in:count,group_by,list,group_by_list')
            ->append('param.group_by', 'requireIf:param.response_format_type,group_by');
    }

    /**
     * GetAppendDemand
     * @return EntityStatisticsValidate
     */
    public function sceneGetBasicDemand(): EntityStatisticsValidate
    {
        return $this->append('param', 'require|array')
            ->append('param.project_ids', 'require|array')
            ->append('param.range_time', 'require|array')
            ->append('param.module_code', 'in:asset,shot')
            ->append('param.page', 'array')
            ->append('param.response_format_type', 'in:count,group_by,list,group_by_list')
            ->append('param.group_by', 'requireIf:param.response_format_type,group_by');
    }

    /**
     * sceneGetDemandDetail
     * @return EntityStatisticsValidate
     */
    public function sceneGetDemandDetail(): EntityStatisticsValidate
    {
        return $this->append('param', 'require|array')
            ->append('param.project_ids', 'require|array')
            ->append('param.range_time', 'require|array')
            ->append('param.standard_append', 'in:yes,no')
            ->append('param.module_code', 'in:asset,shot')
            ->append('param.episode_code', 'string')
            ->append('param.stage_id', 'integer')
            ->append('param.response_format_type', 'in:count,group_by,list,group_by_list')
            ->append('param.group_by', 'requireIf:param.response_format_type,group_by');
    }

    /**
     * sceneGetAssetCategory
     * @return EntityStatisticsValidate
     */
    public function sceneGetAssetCategory(): EntityStatisticsValidate
    {
        return $this->append('param', 'require|array')
            ->append('param.review_feedback_ids', 'require|array');
    }

    /**
     * sceneGetEntityIdsByReviewFeedbackIds
     * @return EntityStatisticsValidate
     */
    public function sceneGetEntityIdsByReviewFeedbackIds(): EntityStatisticsValidate
    {
        return $this->append('param', 'require|array')
            ->append('param.review_feedback_ids', 'require|array')
            ->append('param.module_code', 'in:asset,shot');
    }

    /**
     * GetEntityEstimate
     * @return EntityStatisticsValidate
     */
    public function sceneGetEntityEstimate(): EntityStatisticsValidate
    {
        return $this->append('param', 'require|array')
            ->append('param.project_ids', 'require|array')
            ->append('param.range_time', 'require|array')
            ->append('param.module_code', 'in:asset,shot');
    }
}
